From: Sebastian Keller Date: Mon, 27 Apr 2026 20:53:59 +0000 (+0200) Subject: messageTray: Don't try to focus destroyed actor X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~10^2^2~20 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4d760cae090ffb2f06301aff92229aaa4d0010f1;p=gnome-shell.git messageTray: Don't try to focus destroyed actor When `ungrabFocus()` is called after hiding a notification, the previous focus actor might have already been destroyed and trying to focus it will trigger a gjs error. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/9190 Part-of: --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index e593d0da7..7f3923380 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -88,6 +88,10 @@ class FocusGrabber { this._prevKeyFocusActor = global.stage.get_key_focus(); + this._prevKeyFocusActor?.connectObject('destroy', () => { + this._prevKeyFocusActor = null; + }, this); + global.stage.connectObject('notify::key-focus', this._focusActorChanged.bind(this), this); @@ -101,6 +105,8 @@ class FocusGrabber { if (!this._focused) return false; + this._prevKeyFocusActor?.disconnectObject(this); + global.stage.disconnectObject(this); this._focused = false;